package com.logic.saas.service.security;

import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.logic.saas.persistence.LoginLogMapper;
import com.logic.saas.pojo.LoginLog;
import com.logic.saas.pojo.Ps;
import com.logic.saas.service.BaseService;

@Service
public class LoginLogService extends BaseService {

	private Logger logger = Logger.getLogger(LoginLogService.class.getName());
	@Autowired
	private LoginLogMapper loginLogMapper;
	
	@Transactional
	public Integer insertLoginlog(LoginLog loginLog) {
		Integer newId = null;
		try {
			Map<String, Object> paramMap = new HashMap<String, Object>();
			paramMap.put("loginLog", loginLog);
			loginLogMapper.insertLoginLog(new Ps(paramMap));
			if (loginLog != null && loginLog.getId() != null) {
				newId = loginLog.getId();
			}
		} catch (Exception e) {
			e.printStackTrace();
			logger.error(e.getMessage());
		}
		return newId;
	}
}
